Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-14921]Customers managed by a Reseller need to see how many seats are in their subscription, while still obfuscating the cost of subscription. #12726

Conversation

cyprain-okeke
Copy link
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-14921

📔 Objective

Customers who are now being added as a Reseller Managed Account in our new system can no longer see the amount of seats they are paying for, or how many seats they have active.

The result would be to allow those account owners to see their number of active seats and purchase seats, while still obfuscating the billing details to ensure the Reseller pricing is not available.

📸 Screenshots

Screen.Recording.2025-01-07.at.13.32.38.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@cyprain-okeke cyprain-okeke requested a review from a team as a code owner January 7, 2025 12:41
Copy link
Contributor

github-actions bot commented Jan 7, 2025

Logo
Checkmarx One – Scan Summary & Detailsc9367526-f840-47fc-a127-0fb9b7641718

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 35.49%. Comparing base (2003766) to head (e6e31ad).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...tions/organization-subscription-cloud.component.ts 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12726      +/-   ##
==========================================
- Coverage   35.51%   35.49%   -0.02%     
==========================================
  Files        3008     3008              
  Lines       90920    90929       +9     
  Branches    16912    16914       +2     
==========================================
- Hits        32286    32279       -7     
- Misses      56132    56148      +16     
  Partials     2502     2502              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

jonashendrickx
jonashendrickx previously approved these changes Jan 27, 2025
jonashendrickx
jonashendrickx previously approved these changes Jan 29, 2025
…managed-by-a-reseller-need-to-see-how-many-seats' into pm-14921-customers-managed-by-a-reseller-need-to-see-how-many-seats
Copy link
Contributor

@amorask-bitwarden amorask-bitwarden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for resolving those. I think we still have some cleanup we can do to make this clearer.

Based on my understanding of the PR, you're adding the seat usage message only if the Organization has a reseller.

As such, there's no reason to trigger your getAllUsers function unless the organization has a reseller to begin with.

Basically, what I think would be simplest would be:

  1. Declare a string property called resellerSeatsRemainingMessage.
  2. In the ngOnInit, if the Organization has a reseller, you'd invoke some of the logic from your existing getAllUsers method, but just use it to set the new string property you created:
const allUsers = await this.organizationUserApiService.getAllUsers(this.userOrg.id);

const userCount = allUsers.data.filter((user) =>
    [
        OrganizationUserStatusType.Invited,
        OrganizationUserStatusType.Accepted,
        OrganizationUserStatusType.Confirmed,
    ].includes(user.status),
).length;

const remainingSeats = this.userOrg.seats - userCount;

this.resellerSeatsRemainingMessage = this.i18nService.t(
    "seatsRemaining",
    remainingSeats.toString(),
    this.userOrg.seats.toString(),
);

Then, in your HTML, you can check *ngIf="userOrg.hasReseller && resellerSeatsRemainingMessage".

Feel free to keep that logic that constructs the seats remaining message in a separate method, but if you do, I'd rename it to be more clear since it's not really just getting all users. It'd be more something like getResellerSeatsRemaining or something along those lines.

Then, you can also remove the seatUsageMessage which is just a property pointed at another property.

Copy link
Contributor

@amorask-bitwarden amorask-bitwarden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, nice work and thank you for the updates.

@cyprain-okeke cyprain-okeke merged commit 27a8b43 into main Feb 3, 2025
37 checks passed
@cyprain-okeke cyprain-okeke deleted the pm-14921-customers-managed-by-a-reseller-need-to-see-how-many-seats branch February 3, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants